ds_grid_height


描述

This function will return the height of the given grid. This value is the number of cells the grid has along the y-axis and is always an integer, as shown in the image below:


语法:

ds_grid_height(index);

参数 描述
index This index of the grid to find the height of.


返回:

Real(实数)


例如:

var i, j;
for (i = 0; i < ds_grid_width(grid); i += 1)
   {
   for (j = 0; j < ds_grid_height(grid); j += 1)
      {
      if ds_grid_get(grid, i, j) = 1
         {
         instance_create_Layer(i * 32, j * 32, "Walls", obj_Wall);
         }
      }
   }

上述代码将循环遍历变量"grid"中索引的栅格数据内容,如果在任一单元格中找到的值为1,则它将在场景中对应的位置创建一个"obj_Wall"的实例。